<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\Article
 *
 * @property int $article_id
 * @property int $cat_id
 * @property string $title
 * @property string $content
 * @property string $author
 * @property string $author_email
 * @property string $keywords
 * @property int $article_type
 * @property int $is_open
 * @property int $add_time
 * @property string $file_url
 * @property int $open_type
 * @property string $link
 * @property string|null $description
 * @property string|null $is_recommend 是否为推荐专题文章
 * @property string|null $article_pic 文章图片上传
 * @property int $is_index 是否为精选文章
 * @property-read \App\Models\ArticleCat|null $category
 * @method static \Illuminate\Database\Eloquent\Builder|Article newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Article newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Article query()
 * @method static \Illuminate\Database\Eloquent\Builder|Article whereAddTime($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Article whereArticleId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Article whereArticlePic($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Article whereArticleType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Article whereAuthor($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Article whereAuthorEmail($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Article whereCatId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Article whereContent($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Article whereDescription($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Article whereFileUrl($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Article whereIsIndex($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Article whereIsOpen($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Article whereIsRecommend($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Article whereKeywords($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Article whereLink($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Article whereOpenType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Article whereTitle($value)
 * @mixin \Eloquent
 */
class Article extends Model
{
    protected $table = 'article';
    protected $primaryKey = 'article_id';
    protected $fillable = [
        'article_id', 'cat_id', 'title', 'content', 'author', 'author_email',
        'keywords', 'article_type', 'is_open', 'add_time', 'file_url', 'open_type',
        'link', 'description', 'is_recommend', 'article_pic', 'is_index'
    ];

    public $timestamps = false;

    public function category()
    {
        return $this->belongsTo(ArticleCat::class, 'cat_id', 'cat_id');
    }
}
